#!/bin/bash

environment=$1
clean=$2
basepath=`dirname $0`
if [ "$environment" = "" ];then
  echo "usage:$0 <environment>"
else 
  ./${basepath}/run.sh stop
  cp -a cuc/conf/${environment}/. src/main/resources/
  if [ "$clean" = "clean" ]; then
    mvn clean
  fi
  mvn package -Dmaven.test.skip=true

  ./${basepath}/run.sh start
  ./${basepath}/run.sh status
fi